package com.three.lab.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.three.lab.R;
import com.three.lab.bean.InteractMsgBean;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;

public class InteractMsgAdapter extends BaseQuickAdapter<InteractMsgBean, BaseViewHolder> {

    public InteractMsgAdapter(@Nullable List<InteractMsgBean> data) {
        super(R.layout.item_list_interact_msg, data);
    }

    public InteractMsgAdapter() {
        super(R.layout.item_list_interact_msg);
    }

    @Override
    protected void convert(@NonNull @NotNull BaseViewHolder helper, InteractMsgBean item) {
        helper.setText(R.id.tv_time, item.getTime())
                .setText(R.id.tv_content, item.getConent())
                .addOnClickListener(R.id.ll_detail);
        RecyclerView recyclerView = helper.getView(R.id.rv_avatar);
        StackedAvatarAdapter stackedAvatarAdapter = new StackedAvatarAdapter();

        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false);//这里的true和false控制堆叠的方向，我的效果右侧堆叠所以是false
        linearLayoutManager.setStackFromEnd(true);
        recyclerView.setLayoutManager(linearLayoutManager);
        recyclerView.setAdapter(stackedAvatarAdapter);

        List<String> images = new ArrayList<>();
        images.add("https://m.zhaokaobao.com.cn/uploads/202007/fd4222c22333217927dfc9c68146f0f0.jpg");
        images.add("https://m.zhaokaobao.com.cn/uploads/202007/ce07d7461bf4c33e795c46f2e51b76fc.jpg");
        images.add("https://m.zhaokaobao.com.cn/uploads/202007/ce07d7461bf4c33e795c46f2e51b76fc.jpg");
        images.add("https://m.zhaokaobao.com.cn/uploads/202007/ce07d7461bf4c33e795c46f2e51b76fc.jpg");
        images.add("https://m.zhaokaobao.com.cn/uploads/202007/ce07d7461bf4c33e795c46f2e51b76fc.jpg");
        stackedAvatarAdapter.setNewData(images);
       // SameItemImageAdapter sameItemImageAdapter = new SameItemImageAdapter(mContext,images);
        //recyclerView.setAdapter(sameItemImageAdapter);
    }

}
